package com.ihr360.payroll.model.dto.salary.encrypt;

import com.ihr360.payroll.model.base.IJsonEncryptable;
import com.ihr360.shared.encryption.convertor.StringCryptoConverter;
import org.hibernate.annotations.Type;

import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.List;

import static javax.persistence.GenerationType.IDENTITY;

@Entity
@Table(name = "tmp_encrypt_test")

public class EncryptTest implements IJsonEncryptable {
    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "id")
    private Long id;


    @Column(name = "name")
    @Convert(converter = StringCryptoConverter.class)
    private String firstName;

    @Type(type = "json-encrypt")
    @Column(columnDefinition = "text")
    private List<Encrypt> fields;

    @Type(type = "json-encrypt")
    @Column(columnDefinition = "text")
    private Encrypt field;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public List<Encrypt> getFields() {
        return fields;
    }

    public void setFields(List<Encrypt> fields) {
        this.fields = fields;
    }

    public Encrypt getField() {
        return field;
    }

    public void setField(Encrypt field) {
        this.field = field;
    }
}